<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var obj = {
      a: 10,
      b: 20
    }
    /* var obj2 = {
      ...obj
    };
    obj2.a = 1000;
    console.log(obj);
     */
    var obj2 = Object.assign({},obj);
    obj2.a = 100;
    console.log(obj)
   /*  var obj2 = {
      c:30,
      d: 40
    }

    var obj3 = Object.assign(obj, obj2);
    console.log(obj3);
 */

    /* var arr= [1,2,3];
    var arr2 = [...arr]; */

    // 深克隆 JSON.parse(JSON.stringify(obj))
    // lodash
  </script>
</body>
</html>